#include"UdpSocket.hpp"
#include<assert.h>
class UdpClient{
    public:
    UdpClient(std::string ip,u_int16_t port):_ip(ip),_port(port) {
        assert(_sock.Socket());
    }
    ~UdpClient(){
        _sock.Close();
    }
    bool Sendto(std::string req){
        _sock.Sendto(req,_ip,_port);
        return true;
    }
    bool Recvfrom(std::string* resp){
        _sock.Recvfrom(resp);
        return true;
    }
    private:
    UdpSocket _sock;
    //服务器ip和port
    std::string _ip;
    u_int16_t _port;
};